#!/bin/bash
MPIMG_PATH=$1
OUTPUT_PATH=$2
if [ ! -d $OUTPUT_PATH ];then
    mkdir $OUTPUT_PATH
fi

cat $MPIMG_PATH/amss.mbn > $OUTPUT_PATH/AMSS.mbn
cat $MPIMG_PATH/amsshd.mbn > $OUTPUT_PATH/AMSSHD.mbn
dd if=$MPIMG_PATH/oemsblhd.mbn of=$OUTPUT_PATH/OEMSBL.bin ibs=512 conv=sync
cat $MPIMG_PATH/oemsbl.mbn >> $OUTPUT_PATH/OEMSBL.bin
cat $MPIMG_PATH/qcsbl.mbn > $OUTPUT_PATH/QCSBL.bin
cat $MPIMG_PATH/qcsblhd_cfgdata.mbn > $OUTPUT_PATH/QCSBLHD.bin
if [ -f $MPIMG_PATH/emmc_appsboothd.mbn -a -f $MPIMG_PATH/emmc_appsboot.mbn ];then
dd if=$MPIMG_PATH/emmc_appsboothd.mbn of=$OUTPUT_PATH/APPSBOOT.bin ibs=512 conv=sync
cat $MPIMG_PATH/emmc_appsboot.mbn >> $OUTPUT_PATH/APPSBOOT.bin
fi
